package com.gupao.pattern.delegatestrategy.demo.strategy;

import java.util.HashMap;
import java.util.Map;

public class PayStrategy {

    private static final Map<String,Payment> PAYMENT_MAP = new HashMap<>();

    static {
        PAYMENT_MAP.put("微信",new WechatPay());
        PAYMENT_MAP.put("支付宝",new AliPay());
    }

    public static Payment getPayStrategy(String strategyKey){
       if (PAYMENT_MAP.containsKey(strategyKey)){
           return PAYMENT_MAP.get(strategyKey);
       }
       return new AliPay();
    }

}
